<template>
  <div class="newslist">
    <!-- <router-link :to="'/home/newsinfo'+item.id" v-for="item in newslist" :key="item.id"> -->
    <!-- <van-card :title="item.title" :thumb="item.img_url"> -->
    <van-card :title="item.title" :thumb="item.img_url" v-for="item in newslist" :key="item.id" @click="goNewsInfo(item.id)">
      <div slot="num">
        <span>点击{{item.click}}次</span>
      </div>
      <div slot="price">
        <span>{{item.add_time}}</span>
      </div>
    </van-card>
    <!-- </router-link> -->
  </div>
</template>
<script>
// import { Toast } from 'vant'
export default {
  data: () => ({
    newslist: []
  }),
  created () {
    this.getNewsList()
  },
  methods: {
    async getNewsList () {
      const {
        data: { status, message }
      } = await this.$http.get('api/getnewslist')
      if (status !== 0) return this.$Toast(message)
      this.newslist = message
      this.$Toast(message)
    },
    goNewsInfo (id) {
    //   console.log(id)
      this.$router.push('/home/newsinfo/' + id)
    }
  }
}
</script>
<style lang="less" scoped>
.newslist {
  .van-card__thumb  {
     height: 55px;
  }
  .van-card__content {
      min-height: 55px;
  }
  .van-card__title {
     margin-bottom: 20px;
  }

}
</style>
